#pragma once

#include <fstream>
#include "SystemView.h"


class Writer
{
	SystemView *sys;
	// output files
	ofstream algos;
	ofstream algoDamage;
	ofstream methodDamage;
	ofstream group1;
	ofstream group2;
	ofstream group3;
	ofstream priority;
	ofstream response3;
	ofstream exchange;
	ofstream log;
	ofstream LunsRTs;

public:
	
	string outputFilesName;	// for masters project
	vector <double>* desiredRT;

	Writer(SystemView* s, string outputName, vector<double>* drt);
	virtual ~Writer(void);
	void setSys( SystemView* s);
	
	// writing to files
	void DeviceUtilStatistics(string iteration);
	void writeResponseTimes();
	void writeGroupResponseTimes(string i);
	void writeGroupRT(string i);
	void writeAllRts();	// for storage simulation comparison
	void writeAllRts(int time_Slice);
	void writeGroupRT(int time);
	void writeGroupRTNoGraph(string i);
	void writeOpt(double hitRatio);
	void writeNext(double hitRatio);
	void writeCostAlgo(double hitRatio, int limit);
	void writeAlgoDamage(int iter, map<int, double>* damage, string algoName, string methodName);
	void writeMethodDamage(int iter, map<int, double>* damage, string algoName, string methodName);
	void writeDivisionOfPriorityGroups(int iteration, int groupNo, map<int,double>* ssd, map<int,double>* fc, map<int,double>* sata);
	void writeAllLunPriority(int time);
	void writeNumOfExchanges(int time, int num);
	void writeLog(string line);
	void writePriorityGroups();
	ofstream* Writer::logFile();
	
};

